﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace DOAN.Admin
{
    public partial class Admin : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["quyen"] != null)
                {
                    string magv;
                    if (Session["quyen"] != null)
                    {
                        if ((Session["quyen"].ToString() == "AD") || (Session["quyen"].ToString() == "GV"))
                        {
                            if (Session["Tendangnhap"] != null && Session["Tendangnhap"].ToString() != "")
                            {
                                LinkButton1.Visible = false;
                                lblDnthanhcong.Visible = true;
                                lbtendn.Visible = true;
                                lbtendn.Text = Session["Tendangnhap"].ToString();
                                lbDangky.Visible = false;
                                lbThoat.Visible = true;
                            }
                        }
                        else
                        {
                            Response.Redirect("~/Default.aspx");
                        }
                    }
                }
                else
                {
                    Response.Redirect("LoginAdmin.aspx");
                }
            }
        }
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            //Response.Redirect("DangnhapAdmin.aspx");
            Response.Redirect("../Dangnhap.aspx");
        }
        protected void lbThoat_Click(object sender, EventArgs e)
        {
            
            Session["Tendangnhap"] = "";
            Session["quyen"] = "";
            Session["magv"] = "";
            Session["Tendangnhap"] = "";
            Session.Abandon();
            LinkButton1.Visible = true;
            lbDangky.Visible = true;
            lblDnthanhcong.Visible = false;
            lbThoat.Visible = false;
            lbtendn.Visible = false;
            //Response.Redirect("DangnhapAdmin.aspx");
            Response.Redirect("../Dangnhap.aspx");
        }
        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            Response.Redirect("DangnhapAdmin.aspx");
        }
    }
}
